package 第二章;

import java.util.Scanner;

public class 第二题 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("请输入一个字符串：");
        String str = input.next();
        System.out.print("请输入要查找的字符：");
        String ch = input.next();
        int count = 0;
        String st = str;
        while (st.indexOf(ch) != -1) {
            count++;
            st = st.substring(st.indexOf(ch) + ch.length());
        }

        System.out.println("\"" + str + "\"中出现" + count + "个\"" + ch + "\"。");
    }
}
